package cn.example.vip.mall.seckill.controller;

import cn.example.vip.mall.seckill.entity.SeckillActivity;
import cn.example.vip.mall.seckill.service.SeckillActivityService;
import cn.example.vip.mall.util.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping(value = "/activity")
public class SeckillActivityController {

    @Autowired
    private SeckillActivityService seckillActivityService;
    
    /**
     * 获取有效的活动列表
     */
    @GetMapping
    public RespResult<List<SeckillActivity>> activityList(){
        return RespResult.ok(seckillActivityService.validActivity());
    }
    


}
